﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/Layouts/Admin.Master" AutoEventWireup="true"
    CodeBehind="IncommingOrderDetail.aspx.cs" Inherits="MLM.AdminCP.Pages.IncommingProductOrderDetail"
    meta:resourcekey="PageResource1" %>

<%@ Import Namespace="MLM.AdminCP" %>
<%@ Import Namespace="MLM.AdminCP.Class" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Label runat="server" ID="lbProductOrderDetail" Text="Product Order Detail" meta:resourcekey="lbProductOrderDetailResource1"></asp:Label>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <h3>
        <asp:Label runat="server" ID="lbOrderInformation" Text="Order Information" meta:resourcekey="lbOrderInformationResource1"></asp:Label>
    </h3>
    <asp:FormView runat="server" DataSourceID="ProductOrderEds" meta:resourcekey="FormViewResource1">
        <ItemTemplate>
            <table class="MLMInfoTable" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <b>
                            <asp:Label runat="server" ID="lbOrderID" Text="OrderID" meta:resourcekey="lbOrderIDResource1"></asp:Label></b>
                    </td>
                    <td>
                        <%#Eval("InvoiceID") %>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>
                            <asp:Label runat="server" ID="lbUserID" Text="User ID" meta:resourcekey="lbUserIDResource1"></asp:Label></b>
                    </td>
                    <td>
                        <%#Eval("UserID") %>
                        (<%#Eval("User.FirstName") %><%#Eval("User.LastName") %>)
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>
                            <asp:Label runat="server" ID="lbDepo" Text="Depo" meta:resourcekey="lbDepoResource1"></asp:Label></b>
                    </td>
                    <td>
                        <%#Eval("DepoID") %>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>
                            <asp:Label runat="server" ID="lbCreatedDate" Text="Created Date" meta:resourcekey="lbCreatedDateResource1"></asp:Label></b>
                    </td>
                    <td>
                        <%#Eval("DateTimeCreated") %>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>
                            <asp:Label runat="server" ID="lbStatus" Text="Status" meta:resourcekey="lbStatusResource1"></asp:Label></b>
                    </td>
                    <td>
                        <%# long.Parse(Eval("Status").ToString())==-1?"<span style='color:orange;'>Pending</span>":(long.Parse(Eval("Status").ToString())==1?"<span style='color:green;'>Complete</span>":"<span style='color:red'>Cancelled</span>") %>
                    </td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:FormView>
    <br />
    <asp:Panel runat="server" ID="PanelChangeStatus" meta:resourcekey="PanelChangeStatusResource1">
        <div>
            Change Status:
            <telerik:RadComboBox runat="server" ID="StatusSelect" meta:resourcekey="StatusSelectResource1">
                <Items>
                    <telerik:RadComboBoxItem runat="server" Text="Complete" Value="1" meta:resourcekey="RadComboBoxItemResource1"
                        Owner="" />
                    <telerik:RadComboBoxItem runat="server" Text="In Complete" Value="2" meta:resourcekey="RadComboBoxItemResource2"
                        Owner="" />
                </Items>
            </telerik:RadComboBox>
            <asp:Button runat="server" Text="Save" ID="SaveChangeStatus" meta:resourcekey="SaveChangeStatusResource1" />
            <h4>
                <asp:Label runat="server" ID="lbchagestatus" Text="Note: Change Status to Complete mean product will transfer to User. Becareful!"
                    meta:resourcekey="lbchagestatusResource1"></asp:Label>
            </h4>
        </div>
    </asp:Panel>
    <h3>
        <asp:Label runat="server" ID="lbOrderDetail" Text="Order Detail" meta:resourcekey="lbOrderDetailResource1"></asp:Label>
    </h3>
    <table class="MLMInfoTable" cellpadding="0" cellspacing="0">
        <tr>
            <th>
                <asp:Label runat="server" ID="lbProduct" Text="Product" meta:resourcekey="lbProductResource1"></asp:Label>
            </th>
            <th>
                <asp:Label runat="server" ID="lbVAT" Text="VAT" meta:resourcekey="lbVATResource1"></asp:Label>
            </th>
            <th>
                <asp:Label runat="server" ID="lbQuantity" Text="Quantity" meta:resourcekey="lbQuantityResource1"></asp:Label>
            </th>
            <th>
                <asp:Label runat="server" ID="lbPrice" Text="Price" meta:resourcekey="lbPriceResource1"></asp:Label>
            </th>
            <th>
                <asp:Label runat="server" ID="lbPriceTax" Text="PriceWithTax"></asp:Label>
            </th>
            <th>
                <asp:Label runat="server" ID="lbTotalPrice" Text="Total Price" meta:resourcekey="lbTotalPriceResource1"></asp:Label>
            </th>
            <% if (Permission.GetCurrentRole() != 2 && Permission.GetCurrentRole() != 3)
               {
            %>
            <th>
                <asp:Label runat="server" ID="lbPoint" Text="Point" meta:resourcekey="lbPointResource1"></asp:Label>
            </th>
            <th>
                <asp:Label runat="server" ID="lbTotalPV" Text="Total PV" meta:resourcekey="lbTotalPVResource1"></asp:Label>
            </th>
            <%
                } %>
        </tr>
        <asp:Repeater runat="server" DataSourceID="ProductOrderDetailEds">
            <ItemTemplate>
                <tr>
                    <td>
                        <%#Eval("ProductBas.Name") %>
                    </td>
                    <td>
                        <%#Eval("VAT") %>
                        %
                    </td>
                    <td>
                        <%#Eval("Quantity") %>
                    </td>
                    <td>
                        <%#NumberUtil.Round(PriceUtil.FormatPrice(Eval("Price"),0,dtct,int.Parse(Eval("Invoice.User.RoleID").ToString()),Eval("ProductBaseID"),PriceUtil.GetCountry(dtct,Eval("Invoice.DepoId"))))%>
                    </td>
                    <td>
                        <%#NumberUtil.Round(PriceUtil.FormatPrice(Eval("Price"),-1, dtct, int.Parse(Eval("Invoice.User.RoleID").ToString()), Eval("ProductBaseID"), PriceUtil.GetCountry(dtct, Eval("Invoice.DepoId"))))%>
                    </td>
                    <td>
                        <%#NumberUtil.Round(PriceUtil.FormatPrice(Eval("Price"), -1, dtct, int.Parse(Eval("Invoice.User.RoleID").ToString()), Eval("ProductBaseID"), PriceUtil.GetCountry(dtct, Eval("Invoice.DepoId"))) * long.Parse(Eval("Quantity").ToString()))%>
                    </td>
                    <% if (Permission.GetCurrentRole() != 2 && Permission.GetCurrentRole() != 3)
                       {
                    %>
                    <td>
                        <%#Eval("Point") %>
                        PV
                    </td>
                    <td>
                        <%#float.Parse(Eval("Point").ToString()) * long.Parse(Eval("Quantity").ToString()) %> PV
                    </td>
                    <% } %>
                </tr>
            </ItemTemplate>
        </asp:Repeater>
    </table>
    <asp:EntityDataSource ID="ProductOrderEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EntitySetName="Invoices" Include="User"
        AutoGenerateWhereClause="True" EntityTypeFilter="" Select="">
        <WhereParameters>
            <asp:QueryStringParameter runat="server" Name="InvoiceID" QueryStringField="ID" ConvertEmptyStringToNull="true"
                Type="Int64" />
        </WhereParameters>
    </asp:EntityDataSource>
    <asp:EntityDataSource ID="ProductOrderDetailEds" runat="server" ConnectionString="name=MLMDataContext"
        DefaultContainerName="MLMDataContext" EntitySetName="InvoiceDetails" Include="ProductBas,Invoice,Invoice.User"
        AutoGenerateWhereClause="True" EntityTypeFilter="" Select="">
        <WhereParameters>
            <asp:QueryStringParameter runat="server" Name="InvoiceID" QueryStringField="ID" ConvertEmptyStringToNull="true"
                Type="Int64" />
        </WhereParameters>
    </asp:EntityDataSource>
</asp:Content>
